package cn.wolfcode.p2p.base.controller;

import cn.wolfcode.p2p.business.domain.BidRequest;
import cn.wolfcode.p2p.business.service.IBidRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 首页发标公告+投资列表
 */
@Controller
public class IndexController {

    @Autowired
    private IBidRequestService bidRequestService;

    @RequestMapping("index")
    public String index(Model model) {

        //查询首页发标公告
        List<BidRequest> publishPendngBidRequests = bidRequestService.listPublishPendngBidRequests();
        model.addAttribute("publishPendngBidRequests", publishPendngBidRequests);

        //查询首页投资列表
        List<BidRequest> bidRequests = bidRequestService.listInvestBidRequests();
        model.addAttribute("bidRequests", bidRequests);

        return "main";
    }


}
